#include <iostream>

using namespace std;
// cin 读取
int fill_array(double ar[], int limit)
{
    double temp;
    int i = 0;
    for (i = 0; i < limit; i++)
    {
        cout << "Enter value #" << i + 1 << ": ";
        cin >> temp;
        if (!cin)
        {
            cout << "!cin" << endl;
            break;
        }
        else if (temp < 0){
            cout << "temp < 0" << endl;
            break;
        }
        ar[i] = temp;
    }
    return i;
}

void showArray(double * ar, int num)
{
    for (int i = 0; i < num; i++)
    {
        cout << hex; // hex控制符，以 16进制 输出 int
        cout << int(ar[i]) << endl;
    }
    
}

void func(const double &a)
{
    cout << a ;
}

void func_2(double * const p)
{
    cout << *p;
}

int main(int argc, char const *argv[])
{
    int limit = 5;
    double arr[10];

    int num = fill_array(arr, limit);
    cout << "NUM " << num << endl;
    showArray(arr, num);

    // int * const p = &limit;
    double b = 0;
    func(limit);
    func(b + 1);
    // func_2(limit);

    return 0;
}
